from django.contrib.auth.models import Group, Permission
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.my_paginate import MyPageNumberPagination
from meiduo_admin.sysmanager.permission_group_serializer import PermissionGroupSerializer, PermissionSimpleSerializer


class PermissionGroupViewSet(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = PermissionGroupSerializer
    queryset = Group.objects.order_by('id').all()


class PermissionSimpleView(ListAPIView):
    queryset = Permission.objects.all()
    serializer_class = PermissionSimpleSerializer

